package com.li.service.impl;

import com.li.domain.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.li.mapper.AdminRoleMapper;
import com.li.domain.AdminRole;
import com.li.service.AdminRoleService;
@Service
public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole> implements AdminRoleService{

    @Autowired
    private AdminRoleMapper adminRoleMapper;

    @Override
    public void addAdminRole(Admin admin) {
        Integer aId=admin.getId();
        if (admin.getRoleIdsInt()!=null){
            for (Integer rId:admin.getRoleIdsInt()){
                AdminRole adminRole=new AdminRole();
                adminRole.setAdminId(aId);
                adminRole.setRoleId(rId);
                adminRoleMapper.insert(adminRole);
            }
        }
    }
}
